﻿using System.Xml.XPath;

namespace Songhay.Data
{
    /// <summary>
    /// Defines the contract for the RESTful façade that handles data commands from external layers.
    /// </summary>
    public interface ICommandHandler
    {
        /// <summary>
        /// Execute a data command with strongly typed input.
        /// </summary>
        /// <typeparam name="MessageType">Specifies the type of command input.</typeparam>
        /// <param name="input">The command input.</param>
        /// <returns>Returns an <see cref="System.Xml.XPath.XPathDocument"/>.</returns>
        XPathDocument DoCommand<MessageType>(DataCommandInput<MessageType> input);

        /// <summary>
        /// Execute a data command.
        /// </summary>
        /// <param name="input">The command input.</param>
        /// <returns>Returns an <see cref="System.Xml.XPath.XPathDocument"/>.</returns>
        XPathDocument DoCommand(DataCommandInput input);

        /// <summary>
        /// Reads the <see cref="Songhay.Data.DataAccessItem"/>
        /// of the <see cref="Songhay.Data.DataAccessConfiguration"/>
        /// corresponding to the context of the implementor.
        /// </summary>
        /// <param name="item">the specified <see cref="Songhay.Data.DataAccessItem"/></param>
        void ReadDataAccessItem(DataAccessItem item);
    }
}